<template>
	<router-view></router-view>
</template>

<script>
import { useRouter } from 'vue-router';
import { useStore } from 'vuex'

export default {
    name: 'App',
    setup() {
        const router = useRouter();
		const store = useStore()
        router.beforeEach((to, from, next) => {
            console.log(store.getters.token,'lyf');
            if (to.matched.length === 0) {
                next('/404')
            } else if (!store.getters.token && to.name != 'login'){
				next('/login')
			} else {
                next()
            }
        })
    }
}
</script>

<style>

</style>
